<%@page contentType="text/html" pageEncoding="UTF-8"%>

<%@taglib prefix="html" uri="http://struts.apache.org/tags-html"%>
<%@taglib prefix="logic" uri="http://struts.apache.org/tags-logic"%>
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>

<html:form action="/flightCrewAction">
	<h1>
		<bean:message key="flightcrews" />
	</h1>
	<c:forEach var="crew" items="${flightCrews}">

		<html:radio property="flightCrewId" value="${crew.flightCrewId}">${crew.flightCrewName} 
		<br />
			<bean:message key="crew.structure" />
		</html:radio>
		<table>
			<c:forEach var="employeesCrew" items="${crew.employees}">

				<tr>
					<th>${employeesCrew.name}</th>
					<th>${employeesCrew.surname}</th>
					<th>${employeesCrew.speciality.specialityName}</th>
				</tr>

			</c:forEach>
		</table>
	</c:forEach>
	<br />
	<bean:define id="role" value="${auth.role.roleType}" scope="session" />
	<logic:equal name="role" value="dispatcher">
	<html:errors property="chooseFlightCrew" />
		<html:submit property="method">
			<bean:message key="flightCrew.add" />
		</html:submit>
		<html:submit property="method">
			<bean:message key="flightCrew.modify" />
		</html:submit>
		<html:submit property="method">
			<bean:message key="flightCrew.delete" />
		</html:submit>
	</logic:equal>
</html:form>